package com.efesco.service.hirefire;

import com.bstek.dorado.common.*;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.DBStatement;
import com.bstek.dorado.view.*;
import com.bstek.dorado.view.data.*;
import com.bstek.dorado.view.control.*;
import com.efesco.common.CommUtil;
import com.efesco.system.ClientRightControl;

/**
 * V_hire_fire_dealViewModel
 */
public class V_hire_fire_dealViewModel extends DefaultViewModel {
	
	  protected void initControls()
      throws Exception {
	  super.initControls();

	    String id="HIRE_FIRE_MODIFY";

		Control control=this.getControl(id);

		ClientRightControl clientRightControl=new ClientRightControl();	

		clientRightControl.rightControl(id, control,DoradoContext.getContext());

  }
  protected void doUpdateData(ParameterSet parameters)
      throws Exception {
	  Dataset dataset=this.getDataset("dataset_hire_fire_list"); 
	  DBStatement dbs = new DBStatement();

//	    	 DBStatement dbs =new DBStatement();
//	    	 dbs.setSql("update s_employee_hire_fire set status=2 where EMPLOYEE_HIRE_FIRE_ID="+dataset.getValue("EMPLOYEE_HIRE_FIRE_ID"));
//	    	 dbs.execute();
//	    	 dbs.setSql("update s_in_char_service_transaction set status=2 where in_char_service_transaction_id="+dataset.getValue("IN_CHAR_SERVICE_TRANSACTION_ID"));
//	    	 dbs.execute();
	     CommUtil.UpdateData(dataset,"S_EMPLOYEE_HIRE_FIRE","EMPLOYEE_HIRE_FIRE_ID");
	     CommUtil.filtrateSymbol(dataset, "RESIDENT_ADDRESS");

			dbs.setSql("update s_employee set RESIDENT_ADDRESS='"+dataset.getCurrent().getString("RESIDENT_ADDRESS")
					+"',ARCHIVE_CARD='"+dataset.getCurrent().getString("ARCHIVE_CARD")+"' where employee_id="+dataset.getString("EMPLOYEE_ID"));
			dbs.execute();
			dbs.close();
			
   // super.doUpdateData(parameters);
  }

}
